package com.madcode.landlordbuddy;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

import com.madcode.landlordbuddy.dao.Property;
import com.madcode.landlordbuddy.dao.PropertyDAO;

public class PropertyService implements ApplicationContextAware{
	private static Logger logger = Logger.getLogger(PropertyService.class);
	private ApplicationContext applicationContext;

	public void test(){
		PropertyDAO pd = (PropertyDAO)applicationContext.getBean("myPropertyDao");
		List<Property> properties = pd.getProperties();

		logger.debug("Properties returned: " + properties.size());
	}

	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		this.applicationContext = applicationContext;
		logger.debug("getting applicationContext");
	}
}
